import {
	myRequest
} from './http.js'
import store from '../store';
//登录
export function shoplogin(config) {
	return myRequest({
		url: 'shop/mini/auth',
		method: 'post',
		data: config,
	})
}
//获取签名
export function jsdkSignature(config) {
	return myRequest({
		url: 'wechat/signature/',
		method: 'get',
		data: config,
		type: 'shop'
	})
}



//获取商铺信息
export function getshops(config) {
	return myRequest({
		url: 'shop/profile',
		method: 'get',
		data: config,
		type: 'shop'
	})
}

//获取订单
export function getorder(config) {
	return myRequest({
		url: `shop/orders`,
		method: 'get',
		data: config,
		type: 'shop'
	})
}

//获取一个订单
export function getorderone(config) {
	return myRequest({
		url: `shop/orders/` + config.id,
		method: 'get',
		type: 'shop'
	})

}
//抢单子
export function orderstatus(config) {
	return myRequest({
		url: `shop/orders/` + config.id,
		method: 'put',
		data: config,
		type: 'shop'
	})

}
//店铺上班下班
export function shopupdata(config) {
	return myRequest({
		url: `shop/profile`,
		method: 'put',
		data: config,
		type: 'shop'
	})

}

//获取菜单
export function getproducts(config) {
	return myRequest({
		url: `shop/products`,
		method: 'get',
		data: config,
		type: 'shop'
	})

}
//添加菜单
export function postproducts(config) {
	return myRequest({
		url: `shop/products`,
		method: 'post',
		data: config,
		type: 'shop'
	})

}
//获取商品图片
export function getproductsimg(config) {
	return myRequest({
		url: `shop/pictures`,
		method: 'get',
		data: config,
		type: 'shop'
	})

}
//修改上商品
export function putproducts(config) {
	return myRequest({
		url: `shop/products/${config.id}`,
		method: 'put',
		data: config,
		type: 'shop'
	})

}
//删除产品
export function deleteproducts(config) {
	return myRequest({
		url: `shop/products/${config.id}`,
		method: 'delete',
		data: config,
		type: 'shop'
	})

}

//单独获取商品
export function getproductone(config) {
	return myRequest({
		url: `shop/products/${config.id}`,
		method: 'get',
		type: 'shop'
	})

}

//获取分类
export function getcategory(config) {
	return myRequest({
		url: 'shop/categories/',
		method: 'get',
		type: 'shop'
	})

}
//添加分类
export function postcategory(config) {
	return myRequest({
		url: 'shop/categories/',
		method: 'post',
		data: config,
		type: 'shop'
	})

}
//修改分类
export function putcategory(config) {
	return myRequest({
		url: 'shop/categories/' + config.id,
		method: 'put',
		data: config,
		type: 'shop'
	})
}


//删除分类
export function deletecategory(config) {
	return myRequest({
		url: 'shop/categories/' + config.id,
		method: 'delete',
		type: 'shop'
	})
}


//获取餐桌
export function gettables(config) {
	return myRequest({
		url: 'shop/tables',
		method: 'get',
		type: 'shop'
	})

}
//添加餐桌
export function posttable(config) {
	return myRequest({
		url: 'shop/tables',
		method: 'post',
		data: config,
		type: 'shop'
	})

}
//修改餐桌
export function puttable(config) {
	return myRequest({
		url: 'shop/tables/' + config.id,
		method: 'put',
		data: config,
		type: 'shop'
	})
}

//删除餐桌
export function deletetable(config) {
	return myRequest({
		url: 'shop/tables/' + config.id,
		method: 'delete',
		type: 'shop'
	})
}

//获取所有员工
export function getemployees(config) {
	return myRequest({
		url: 'shop/employees/',
		method: 'get',
		type: 'shop'
	})

}

//添加员工
export function postemployees(config) {
	return myRequest({
		url: 'shop/employees/',
		method: 'post',
		data: config,
		type: 'shop'
	})

}
//修改员工
export function putemployees(config) {
	return myRequest({
		url: 'shop/employees/' + config.id,
		method: 'put',
		data: config,
		type: 'shop'
	})
}
//删除员工
export function deleteemployees(config) {
	return myRequest({
		url: 'shop/employees/' + config.id,
		method: 'delete',
		type: 'shop'
	})
}

//获取钱包
export function postmoney(config) {
	return myRequest({
		url: `shop/${store.state.shop_id}/money`,
		method: 'post',
		type: 'shop'
	})

}

//获取统计
export function shopstats(config) {
	return myRequest({
		url: 'shop/stats',
		method: 'get',
		data: config,
		type: 'shop'
	})

}
//修改密码
export function putpassword(config) {
	return myRequest({
		url:'shop/password/',
		method: 'put',
		data: config,
		type: 'shop'
	})
}